package tx.oopa.circuit.port.impl;

import tx.oopa.circuit.port.AbstractComponent;
import tx.oopa.circuit.port.AbstractSinglePort;

/**
 * Implementation of the logical NOT function:
 * 
 * True => False
 * False => True
 * 
 * @author Xander van Rijn
 *
 */
public class NOTPort extends AbstractSinglePort {

    private static final String ID = "NOT";
    @SuppressWarnings("unused")
    private static NOTPort instance = new NOTPort(ID);
    
    protected NOTPort() {}
    
    protected NOTPort(String ID) {
        super(ID);
    }
    
    @Override
    public Boolean performLogicalFunction() {
        return !this.input;
    }

    @Override
    public AbstractComponent clone() {
        return new NOTPort();
    }
    
    public String getID() {
        return ID;
    }
}

